<template>
          <tr>
          <td>{{arr.id}}</td>
          <td>{{arr.name}}</td>
          <td>{{arr.date|mhsj}}</td>
          <td>
            <button :disabled="del1"  @click="del(arr.id)">删除</button>
            <button  @click="modify(arr.id) ">编辑</button>
          </td>
        </tr>
</template>

<script>
export default {
  props: {
    arr: {
      type: Object, // 获取数组里面的  必须 单词
      required: true// 必须的
    },
    del1: {
      type: Boolean,
      required: true// 必须的
    }
  },
  filters: {
    mhsj: (val) => { // 美化时间的
      const data = new Date(val)
      const y = data.getFullYear()
      const m = (data.getMonth() + 1).toString().padStart(2, 0)
      const d = (data.getDate()).toString().padStart(2, 0)
      return `${y}-${m}-${d}`
    }
  },
  computed: {
  },
  created () {

  },
  methods: {
    del (id) { // 点击删除时
      this.$emit('del', id)
    },
    modify (id) { // 点击编辑时
      this.$emit('modify', id)
    }
  }

}
</script>
